tangled
alpha
login
or
join now
zzstoatzz.io
/
scripts
0
fork
atom
for assorted things
0
fork
atom
overview
issues
pulls
pipelines
update name
zzstoatzz.io
10 months ago
e43c5080
16b36c1d
+49
-38
2 changed files
expand all
collapse all
unified
split
turn-off-all-the-lights
update-lights
-38
turn-off-all-the-lights
···
1
1
-
#!/usr/bin/env -S uv run --script --quiet
2
2
-
# /// script
3
3
-
# requires-python = ">=3.12"
4
4
-
# dependencies = ["marvin@git+https://github.com/prefecthq/marvin.git"]
5
5
-
# ///
6
6
-
import marvin
7
7
-
from pydantic_settings import BaseSettings, SettingsConfigDict
8
8
-
from pydantic import Field
9
9
-
from pydantic_ai.mcp import MCPServerStdio
10
10
-
11
11
-
12
12
-
class Settings(BaseSettings):
13
13
-
model_config = SettingsConfigDict(env_file=".env")
14
14
-
15
15
-
hue_bridge_ip: str = Field(default=...)
16
16
-
hue_bridge_username: str = Field(default=...)
17
17
-
18
18
-
19
19
-
settings = Settings()
20
20
-
21
21
-
hub_mcp = MCPServerStdio(
22
22
-
command="uvx",
23
23
-
args=[
24
24
-
"smart-home@git+https://github.com/jlowin/fastmcp.git#subdirectory=examples/smart_home"
25
25
-
],
26
26
-
env={
27
27
-
"HUE_BRIDGE_IP": settings.hue_bridge_ip,
28
28
-
"HUE_BRIDGE_USERNAME": settings.hue_bridge_username,
29
29
-
},
30
30
-
)
31
31
-
32
32
-
33
33
-
if __name__ == "__main__":
34
34
-
agent = marvin.Agent(
35
35
-
model="gpt-4o",
36
36
-
mcp_servers=[hub_mcp],
37
37
-
)
38
38
-
agent.run("turn off all the lights")
+49
update-lights
···
1
1
+
#!/usr/bin/env -S uv run --script --quiet
2
2
+
# /// script
3
3
+
# requires-python = ">=3.12"
4
4
+
# dependencies = ["marvin@git+https://github.com/prefecthq/marvin.git"]
5
5
+
# ///
6
6
+
import marvin
7
7
+
import argparse
8
8
+
from pydantic_settings import BaseSettings, SettingsConfigDict
9
9
+
from pydantic import Field
10
10
+
from pydantic_ai.mcp import MCPServerStdio
11
11
+
12
12
+
13
13
+
class Settings(BaseSettings):
14
14
+
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
15
15
+
16
16
+
hue_bridge_ip: str = Field(default=...)
17
17
+
hue_bridge_username: str = Field(default=...)
18
18
+
19
19
+
20
20
+
settings = Settings()
21
21
+
22
22
+
hub_mcp = MCPServerStdio(
23
23
+
command="uvx",
24
24
+
args=[
25
25
+
"smart-home@git+https://github.com/jlowin/fastmcp.git#subdirectory=examples/smart_home"
26
26
+
],
27
27
+
env={
28
28
+
"HUE_BRIDGE_IP": settings.hue_bridge_ip,
29
29
+
"HUE_BRIDGE_USERNAME": settings.hue_bridge_username,
30
30
+
},
31
31
+
)
32
32
+
33
33
+
34
34
+
if __name__ == "__main__":
35
35
+
parser = argparse.ArgumentParser(description="Send a command to the Marvin agent.")
36
36
+
parser.add_argument(
37
37
+
"--message",
38
38
+
"-m",
39
39
+
type=str,
40
40
+
default="turn off all the lights",
41
41
+
help="The message to send to the agent (defaults to 'turn off all the lights').",
42
42
+
)
43
43
+
args = parser.parse_args()
44
44
+
45
45
+
agent = marvin.Agent(
46
46
+
model="gpt-4o",
47
47
+
mcp_servers=[hub_mcp],
48
48
+
)
49
49
+
agent.run(args.message)