Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,28 @@ https://github.com/user-attachments/assets/65d0f34e-2bb7-42bf-ab5c-be1cca96a2c6

- **Cost tracking**: Automatically calculates and tracks the cost of each AI model run, providing transparency and helping you manage your AI budget effectively. Learn more about [cost tracking](https://docs.workflowai.com/python-sdk/agent#cost-latency).

```python
class AnswerQuestionInput(BaseModel):
question: str

class AnswerQuestionOutput(BaseModel):
answer: str

@workflowai.agent(id="answer-question")
async def answer_question(input: AnswerQuestionInput) -> AnswerQuestionOutput:
"""
Answer a question.
"""
...

run = await answer_question.run(AnswerQuestionInput(question="What is the history of Paris?"))
print(f"Cost: $ {run.cost_usd:.5f}")
print(f"Latency: {run.duration_seconds:.2f}s")

# Cost: $ 0.00745
# Latency: 8.99s
```

## Get Started

`workflowai` requires Python 3.9 or higher.
Expand Down