mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 05:58:08 +01:00
fix(setup): add stripe to dep (#39)
This commit is contained in:
3
Makefile
3
Makefile
@@ -5,6 +5,7 @@ setup: check-python setup-venv install
|
|||||||
|
|
||||||
check-python:
|
check-python:
|
||||||
@which python3 >/dev/null 2>&1 || (echo "Python 3 is required. Please install it first." && exit 1)
|
@which python3 >/dev/null 2>&1 || (echo "Python 3 is required. Please install it first." && exit 1)
|
||||||
|
@which poetry >/dev/null 2>&1 || (echo "Poetry is required. Please install it first." && exit 1)
|
||||||
|
|
||||||
setup-venv:
|
setup-venv:
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
@@ -59,4 +60,4 @@ help:
|
|||||||
@echo " make run-legacy-worker - Start the legacy worker"
|
@echo " make run-legacy-worker - Start the legacy worker"
|
||||||
@echo " make run-enterprise - Build and run the enterprise .NET worker"
|
@echo " make run-enterprise - Build and run the enterprise .NET worker"
|
||||||
@echo " make setup-temporal-mac - Install and start Temporal server on Mac"
|
@echo " make setup-temporal-mac - Install and start Temporal server on Mac"
|
||||||
@echo " make run-dev - Start all development services (worker, API, frontend) in parallel"
|
@echo " make run-dev - Start all development services (worker, API, frontend) in parallel"
|
||||||
18
poetry.lock
generated
18
poetry.lock
generated
@@ -2358,6 +2358,22 @@ anyio = ">=3.4.0,<5"
|
|||||||
[package.extras]
|
[package.extras]
|
||||||
full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart (>=0.0.7)", "pyyaml"]
|
full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart (>=0.0.7)", "pyyaml"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "stripe"
|
||||||
|
version = "11.6.0"
|
||||||
|
description = "Python bindings for the Stripe API"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.6"
|
||||||
|
groups = ["main"]
|
||||||
|
files = [
|
||||||
|
{file = "stripe-11.6.0-py2.py3-none-any.whl", hash = "sha256:6e6cf09ebb6d5fc2d708401cb8868fd7bff987a6d09a0433caaa92c62f97dbc5"},
|
||||||
|
{file = "stripe-11.6.0.tar.gz", hash = "sha256:0ced7cce23a6cb1a393c86a1f7f9435c9d83ae7cbd556362868caf62cb44a92c"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
requests = {version = ">=2.20", markers = "python_version >= \"3.0\""}
|
||||||
|
typing-extensions = {version = ">=4.5.0", markers = "python_version >= \"3.7\""}
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "temporalio"
|
name = "temporalio"
|
||||||
version = "1.9.0"
|
version = "1.9.0"
|
||||||
@@ -2759,4 +2775,4 @@ type = ["pytest-mypy"]
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.1"
|
lock-version = "2.1"
|
||||||
python-versions = ">=3.10,<4.0"
|
python-versions = ">=3.10,<4.0"
|
||||||
content-hash = "d9a981a06732679724e07fb4f74b03fc6290f17a3b85bea3356ef72335be377d"
|
content-hash = "ae5534663e9fa1ab21fb50bd6a7007aa201a22da0c3b729289f8a931434c14bf"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ authors = [
|
|||||||
]
|
]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
||||||
# By default, Poetry will find packages automatically,
|
# By default, Poetry will find packages automatically,
|
||||||
# but explicitly including them is fine:
|
# but explicitly including them is fine:
|
||||||
packages = [
|
packages = [
|
||||||
{ include = "**/*.py", from = "." }
|
{ include = "**/*.py", from = "." }
|
||||||
@@ -38,6 +38,7 @@ uvicorn = "^0.34.0"
|
|||||||
python-dotenv = "^1.0.1"
|
python-dotenv = "^1.0.1"
|
||||||
requests = "^2.32.3"
|
requests = "^2.32.3"
|
||||||
pandas = "^2.2.3"
|
pandas = "^2.2.3"
|
||||||
|
stripe = "^11.4.1"
|
||||||
gtfs-kit = "^10.1.1"
|
gtfs-kit = "^10.1.1"
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
|
|||||||
24
setup.md
24
setup.md
@@ -47,7 +47,7 @@ If you prefer to run commands manually, follow these steps:
|
|||||||
|
|
||||||
### Agent Goal Configuration
|
### Agent Goal Configuration
|
||||||
|
|
||||||
The agent can be configured to pursue different goals using the `AGENT_GOAL` environment variable in your `.env` file. If unset, default is `goal_choose_agent_type`.
|
The agent can be configured to pursue different goals using the `AGENT_GOAL` environment variable in your `.env` file. If unset, default is `goal_choose_agent_type`.
|
||||||
|
|
||||||
If the first goal is `goal_choose_agent_type` the agent will support multiple goals using goal categories defined by `GOAL_CATEGORIES` in your .env file. If unset, default is all. We recommend starting with `fin`.
|
If the first goal is `goal_choose_agent_type` the agent will support multiple goals using goal categories defined by `GOAL_CATEGORIES` in your .env file. If unset, default is all. We recommend starting with `fin`.
|
||||||
```bash
|
```bash
|
||||||
@@ -60,7 +60,7 @@ See the section Goal-Specific Tool Configuration below for tool configuration fo
|
|||||||
|
|
||||||
Note: We recommend using OpenAI's GPT-4o or Claude 3.5 Sonnet for the best results. There can be significant differences in performance and capabilities between models, especially for complex tasks.
|
Note: We recommend using OpenAI's GPT-4o or Claude 3.5 Sonnet for the best results. There can be significant differences in performance and capabilities between models, especially for complex tasks.
|
||||||
|
|
||||||
The agent uses LiteLLM to interact with various LLM providers. Configure theqfollowing environment variables in your `.env` file:
|
The agent uses LiteLLM to interact with various LLM providers. Configure the following environment variables in your `.env` file:
|
||||||
|
|
||||||
- `LLM_MODEL`: The model to use (e.g., "openai/gpt-4o", "anthropic/claude-3-sonnet", "google/gemini-pro", etc.)
|
- `LLM_MODEL`: The model to use (e.g., "openai/gpt-4o", "anthropic/claude-3-sonnet", "google/gemini-pro", etc.)
|
||||||
- `LLM_KEY`: Your API key for the selected provider
|
- `LLM_KEY`: Your API key for the selected provider
|
||||||
@@ -167,7 +167,7 @@ npm install
|
|||||||
npx vite
|
npx vite
|
||||||
```
|
```
|
||||||
Access the UI at `http://localhost:5173`
|
Access the UI at `http://localhost:5173`
|
||||||
|
|
||||||
|
|
||||||
## Goal-Specific Tool Configuration
|
## Goal-Specific Tool Configuration
|
||||||
Here is configuration guidance for specific goals. Travel and financial goals have configuration & setup as below.
|
Here is configuration guidance for specific goals. Travel and financial goals have configuration & setup as below.
|
||||||
@@ -175,7 +175,7 @@ Here is configuration guidance for specific goals. Travel and financial goals ha
|
|||||||
- `AGENT_GOAL=goal_event_flight_invoice` - Helps users find events, book flights, and arrange train travel with invoice generation
|
- `AGENT_GOAL=goal_event_flight_invoice` - Helps users find events, book flights, and arrange train travel with invoice generation
|
||||||
- This is the scenario in the [original video](https://www.youtube.com/watch?v=GEXllEH2XiQ)
|
- This is the scenario in the [original video](https://www.youtube.com/watch?v=GEXllEH2XiQ)
|
||||||
|
|
||||||
#### Configuring Agent Goal: goal_event_flight_invoice
|
#### Configuring Agent Goal: goal_event_flight_invoice
|
||||||
* The agent uses a mock function to search for events. This has zero configuration.
|
* The agent uses a mock function to search for events. This has zero configuration.
|
||||||
* By default the agent uses a mock function to search for flights.
|
* By default the agent uses a mock function to search for flights.
|
||||||
* If you want to use the real flights API, go to `tools/search_flights.py` and replace the `search_flights` function with `search_flights_real_api` that exists in the same file.
|
* If you want to use the real flights API, go to `tools/search_flights.py` and replace the `search_flights` function with `search_flights_real_api` that exists in the same file.
|
||||||
@@ -190,7 +190,7 @@ Here is configuration guidance for specific goals. Travel and financial goals ha
|
|||||||
- `AGENT_GOAL=goal_match_train_invoice` - Focuses on Premier League match attendance with train booking and invoice generation
|
- `AGENT_GOAL=goal_match_train_invoice` - Focuses on Premier League match attendance with train booking and invoice generation
|
||||||
- This goal was part of [Temporal's Replay 2025 conference keynote demo](https://www.youtube.com/watch?v=YDxAWrIBQNE)
|
- This goal was part of [Temporal's Replay 2025 conference keynote demo](https://www.youtube.com/watch?v=YDxAWrIBQNE)
|
||||||
- Note, there is failure built in to this demo (the train booking step) to show how the agent can handle failures and retry. See Tool Configuration below for details.
|
- Note, there is failure built in to this demo (the train booking step) to show how the agent can handle failures and retry. See Tool Configuration below for details.
|
||||||
#### Configuring Agent Goal: goal_match_train_invoice
|
#### Configuring Agent Goal: goal_match_train_invoice
|
||||||
NOTE: This goal was developed for an on-stage demo and has failure (and its resolution) built in to show how the agent can handle failures and retry.
|
NOTE: This goal was developed for an on-stage demo and has failure (and its resolution) built in to show how the agent can handle failures and retry.
|
||||||
* Omit `FOOTBALL_DATA_API_KEY` from .env for the `SearchFixtures` tool to automatically return mock Premier League fixtures. Finding a real match requires a key from [Football Data](https://www.football-data.org). Sign up for a free account, then see the 'My Account' page to get your API token.
|
* Omit `FOOTBALL_DATA_API_KEY` from .env for the `SearchFixtures` tool to automatically return mock Premier League fixtures. Finding a real match requires a key from [Football Data](https://www.football-data.org). Sign up for a free account, then see the 'My Account' page to get your API token.
|
||||||
* We use a mock function to search for trains. Start the train API server to use the real API: `python thirdparty/train_api.py`
|
* We use a mock function to search for trains. Start the train API server to use the real API: `python thirdparty/train_api.py`
|
||||||
@@ -212,15 +212,15 @@ poetry run python thirdparty/train_api.py
|
|||||||
|
|
||||||
##### Python Train Legacy Worker
|
##### Python Train Legacy Worker
|
||||||
> Agent Goal: goal_match_train_invoice only
|
> Agent Goal: goal_match_train_invoice only
|
||||||
|
|
||||||
These are Python activities that fail (raise NotImplemented) to show how Temporal handles a failure. You can run these activities with.
|
These are Python activities that fail (raise NotImplemented) to show how Temporal handles a failure. You can run these activities with.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
poetry run python scripts/run_legacy_worker.py
|
poetry run python scripts/run_legacy_worker.py
|
||||||
```
|
```
|
||||||
|
|
||||||
The activity will fail and be retried infinitely. To rescue the activity (and its corresponding workflows), kill the worker and run the .NET one in the section below.
|
The activity will fail and be retried infinitely. To rescue the activity (and its corresponding workflows), kill the worker and run the .NET one in the section below.
|
||||||
|
|
||||||
##### .NET (enterprise) Worker ;)
|
##### .NET (enterprise) Worker ;)
|
||||||
We have activities written in C# to call the train APIs.
|
We have activities written in C# to call the train APIs.
|
||||||
```bash
|
```bash
|
||||||
@@ -233,12 +233,12 @@ If you're running your train API above on a different host/port then change the
|
|||||||
#### Goals: FIN - Money Movement and Loan Application
|
#### Goals: FIN - Money Movement and Loan Application
|
||||||
Make sure you have the mock users you want (such as yourself) in [the account mock data file](./tools/data/customer_account_data.json).
|
Make sure you have the mock users you want (such as yourself) in [the account mock data file](./tools/data/customer_account_data.json).
|
||||||
|
|
||||||
- `AGENT_GOAL=goal_fin_move_money` - This scenario _can_ initiate a secondary workflow to move money. Check out [this repo](https://github.com/temporal-sa/temporal-money-transfer-java) - you'll need to get the worker running and connected to the same account as the agentic worker.
|
- `AGENT_GOAL=goal_fin_move_money` - This scenario _can_ initiate a secondary workflow to move money. Check out [this repo](https://github.com/temporal-sa/temporal-money-transfer-java) - you'll need to get the worker running and connected to the same account as the agentic worker.
|
||||||
By default it will _not_ make a real workflow, it'll just fake it. If you get the worker running and want to start a workflow, in your [.env](./.env):
|
By default it will _not_ make a real workflow, it'll just fake it. If you get the worker running and want to start a workflow, in your [.env](./.env):
|
||||||
```bash
|
```bash
|
||||||
FIN_START_REAL_WORKFLOW=FALSE #set this to true to start a real workflow
|
FIN_START_REAL_WORKFLOW=FALSE #set this to true to start a real workflow
|
||||||
```
|
```
|
||||||
- `AGENT_GOAL=goal_fin_loan_application` - This scenario _can_ initiate a secondary workflow to apply for a loan. Check out [this repo](https://github.com/temporal-sa/temporal-latency-optimization-scenarios) - you'll need to get the worker running and connected to the same account as the agentic worker.
|
- `AGENT_GOAL=goal_fin_loan_application` - This scenario _can_ initiate a secondary workflow to apply for a loan. Check out [this repo](https://github.com/temporal-sa/temporal-latency-optimization-scenarios) - you'll need to get the worker running and connected to the same account as the agentic worker.
|
||||||
By default it will _not_ make a real workflow, it'll just fake it. If you get the worker running and want to start a workflow, in your [.env](./.env):
|
By default it will _not_ make a real workflow, it'll just fake it. If you get the worker running and want to start a workflow, in your [.env](./.env):
|
||||||
```bash
|
```bash
|
||||||
FIN_START_REAL_WORKFLOW=FALSE #set this to true to start a real workflow
|
FIN_START_REAL_WORKFLOW=FALSE #set this to true to start a real workflow
|
||||||
|
|||||||
Reference in New Issue
Block a user